class CreateRequests < ActiveRecord::Migration
  def self.up
    # I'm not very familiar with migrate,
    # so do the work dirty by using raw SQL.
    # Only works for MySQL!
    execute "CREATE TABLE requests (
      id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
      user_id INT NOT NULL,
      requester_id INT NOT NULL,
      request_at DATETIME NOT NULL,
      FOREIGN KEY (user_id) REFERENCES users (id),
      FOREIGN KEY (requester_id) REFERENCES users (id)
    );"
  end

  def self.down
    drop_table :requests
  end
end
